`
https://leetcode.cn/problems/split-a-string-into-the-max-number-of-unique-substrings/
`

/**
 * @param {string} s
 * @return {number}
 */
var maxUniqueSplit = function (s) {
  let res = 0
  const exist = new Set()
  const track = []

  function backtrack(start) {
    if (start === s.length) {
      res = Math.max(res, track.length)
    }

    for (let i = start + 1; i <= s.length; i++) {
      const substring = s.slice(start, i)
      if (exist.has(substring)) continue
      exist.add(substring)
      track.push(substring)
      backtrack(i)
      track.pop()
      exist.delete(substring)
    }
  }

  backtrack(0)
  return res
};